<?php

/*
|--------------------------------------------------------------------------
| Model Factories
|--------------------------------------------------------------------------
|
| Here you may define all of your model factories. Model factories give
| you a convenient way to create models for testing and seeding your
| database. Just tell the factory how a default model should look.
|
*/

/** @var \Illuminate\Database\Eloquent\Factory $factory */
$factory->define(\App\Models\User\User::class, function (Faker\Generator $faker) {
	static $password;

	return [
		'name' => $faker->name,
		'email' => $faker->unique()->safeEmail,
		'password' => $password ?: $password = bcrypt('secret'),
		'remember_token' => str_random(10),
	];
});

$factory->define(App\Models\Activity\Activity::class, function (Faker\Generator $faker) {

    return [
        'user_id' => \Ramsey\Uuid\Uuid::uuid4()->toString(),
        'category' => 1,
        'template_id' => \Ramsey\Uuid\Uuid::uuid4()->toString(),
        'model_id' => \Ramsey\Uuid\Uuid::uuid4()->toString(),
        'clicks' => 10,
        'isPause' => false,
        'joins' => 20,
        'winnings' => 20,
        'rule' => json_encode(['绝对不意气用事', '绝对不漏判任何一件坏事', '绝对裁判得公正漂亮']),
        'name' => '投票' . \App\Support\Helpers\StringHelper::quickRandom(3),
        'startTime' => \Carbon\Carbon::now()->format('Y-m-d H:i:s'),
        'endTime' => \Carbon\Carbon::now()->addDay(20)->format('Y-m-d H:i:s'),
        'limit' => '{"num":0,"type":"day"}',
        'backgroundImg' => '',
        'backgroundColor' => '',
        'description' => '',
        'shares' => '{}',
        'group_code' => $faker->name,
    ];
});


$factory->define(\App\Models\ActivityModel\ActivityModel::class, function (\Faker\Generator $faker) {

    return [
        'id' => \Ramsey\Uuid\Uuid::uuid4()->toString(),
        'name' => $faker->name,
        'rule' => str_random(10)
    ];
});

$factory->define(\App\Models\ActivityModelTemplate\ActivityModelTemplate::class, function (\Faker\Generator $faker) {

    return [
        'id' => \Ramsey\Uuid\Uuid::uuid4()->toString(),
        'model_id' => \Ramsey\Uuid\Uuid::uuid4()->toString(),
        'name' => $faker->name,
        'template' => 'default',
        'thumb' => '/images/admin/redpack_rain.jpg',
        'url' => '',
        'isBackgroundImage' => true,
        'isBackgroundColor' => false,
    ];
});

$factory->define(\App\Models\ActivityPoints\ActivityPoints::class, function (\Faker\Generator $faker) {

	return [
		'point_key' => str_random(32),
		'point_name' => str_random(10),
		'desc' => str_random(20),
		'user_id' => str_random(15),
	];
});

$factory->define(\App\Models\Prize\Prize::class, function (\Faker\Generator $faker) {
	return [
		'user_id' => env('DEFAULT_USER_ID'),
		'type_code' => \App\Models\PrizeType\PrizeType::WECHAT,
		'name' => $faker->name,
		'stock_number' => 1,
		'group_code' => 'test',
		'resource' => \App\Models\Prize\Prize::BUILD_BY_CREATE,
		'is_valid' => \App\Models\Prize\Prize::IS_VALID_YES,
	];
});

$factory->define(\App\Models\VoteGroup\VoteGroup::class, function (\Faker\Generator $faker) {
	return [
		'activity_id' => '705cb052-b228-4eeb-9b56-89ab13340245',
		'order_id' => 0,
		'type' => 1,
		'title' => $faker->title,
		'memo' => $faker->text()
	];
});

$factory->define(\App\Models\VoteCandidate\VoteCandidate::class, function (\Faker\Generator $faker) {
	return [
		'activity_id' => '705cb052-b228-4eeb-9b56-89ab13340245',
		'group_id' => '6739e466-a834-4411-8b52-e6d92229c62a',
		'order_id' => 0,
		'title' => $faker->title,
		'type' => mt_rand(1, 4),
		'cover_url' => $faker->imageUrl(),
		'resource_url' => $faker->url,
		'content' => $faker->text(),
	];
});
